import * as React from 'react';
import { Backdrop, CircularProgress } from '@mui/material';
import { useSelector } from 'react-redux';
import { RootState } from '../../redux/store';
import style from './Loader.module.scss';



const Loader = () => {
    const { workload } = useSelector((rootState: RootState) => rootState.ui);

    return (
        <Backdrop open={workload > 0} classes={{ root: style.backdrop }}>
            <CircularProgress classes={{ root: style.progress }} />
        </Backdrop>
    );
};

export default Loader;
